package GUI;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

import GUI_creator.MainPanelCreator;
import GUI_player.PlayerPanel;
import GUI_solver.SolverPanel;

@SuppressWarnings("serial")
public class MainPanel extends JPanel {

	/**
	 * Create the panel.
	 */
	public MainPanel() {
		GridBagLayout gridBagLayout = new GridBagLayout();
		gridBagLayout.columnWidths = new int[]{137, 0, 0, 0};
		gridBagLayout.rowHeights = new int[]{60, 0, 41, 36, 37, 38, 0, 0, 0};
		gridBagLayout.columnWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE};
		gridBagLayout.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		setLayout(gridBagLayout);
		
		JLabel lblFlowfree = new JLabel("FlowFree");
		lblFlowfree.setFont(new Font("Arial", Font.BOLD, 20));
		GridBagConstraints gbc_lblFlowfree = new GridBagConstraints();
		gbc_lblFlowfree.insets = new Insets(0, 0, 5, 5);
		gbc_lblFlowfree.gridx = 1;
		gbc_lblFlowfree.gridy = 1;
		add(lblFlowfree, gbc_lblFlowfree);
		
		JButton button = new JButton("Criador de Tabuleiros");
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				GUI.frame.setContentPane(new MainPanelCreator());
				((JPanel)GUI.frame.getContentPane()).revalidate();
				GUI.frame.repaint();
			}
		});
		GridBagConstraints gbc_button = new GridBagConstraints();
		gbc_button.fill = GridBagConstraints.HORIZONTAL;
		gbc_button.insets = new Insets(0, 0, 5, 5);
		gbc_button.gridx = 1;
		gbc_button.gridy = 3;
		add(button, gbc_button);
		
		JButton btnResoluoManual = new JButton("Resolu\u00E7\u00E3o Manual");
		btnResoluoManual.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				GUI.frame.setBounds(100, 100, 450, 300);
				GUI.frame.setSize(600, 600);	
				GUI.frame.setContentPane( new PlayerPanel());
				((JPanel)GUI.frame.getContentPane()).revalidate();
				GUI.frame.repaint();
				 
				
			}
		});
		GridBagConstraints gbc_btnResoluoManual = new GridBagConstraints();
		gbc_btnResoluoManual.fill = GridBagConstraints.HORIZONTAL;
		gbc_btnResoluoManual.insets = new Insets(0, 0, 5, 5);
		gbc_btnResoluoManual.gridx = 1;
		gbc_btnResoluoManual.gridy = 4;
		add(btnResoluoManual, gbc_btnResoluoManual);
		
		JButton btnResoluoAutomtica = new JButton("Resolu\u00E7\u00E3o Autom\u00E1tica");
		btnResoluoAutomtica.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				GUI.frame.setBounds(100, 100, 450, 300);
				GUI.frame.setSize(600, 600);
				GUI.frame.setContentPane( new SolverPanel());
				((JPanel)GUI.frame.getContentPane()).revalidate();
				GUI.frame.repaint();
			}
		});
		GridBagConstraints gbc_btnResoluoAutomtica = new GridBagConstraints();
		gbc_btnResoluoAutomtica.fill = GridBagConstraints.HORIZONTAL;
		gbc_btnResoluoAutomtica.insets = new Insets(0, 0, 5, 5);
		gbc_btnResoluoAutomtica.gridx = 1;
		gbc_btnResoluoAutomtica.gridy = 5;
		add(btnResoluoAutomtica, gbc_btnResoluoAutomtica);

	}

}
